import http from "../request";
const apibase = "/api/ERecipe";

//左侧列表
var getERecipeMaterialList = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/GetERecipeMaterialList`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

//根据物料编码获取配方
var getERecipeList = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/GetERecipeList`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

//修改配方
var updateERecipe = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/UpdateERecipe`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

//修改配方明细
var updateERecipeDetail = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/UpdateERecipeDetail`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

//审核配方
var checkERecipe = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/CheckERecipe`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

//反审核配方
var noCheckERecipe = function (data) {
    return new Promise((resolve, reject) => {
        http
            .post(apibase + `/NoCheckERecipe`, data)
            .then((res) => {
                resolve(res);
            })
            .catch((error) => {
                reject(error);
            });
    });
};

export { getERecipeMaterialList, getERecipeList, updateERecipe, updateERecipeDetail, checkERecipe, noCheckERecipe };
